#coding=utf-8
from storm.locals import *
import os.path as op
import adwords.settings as s

def get_store():

    if s.db_engine == 'sqlite':
        path = op.abspath(".") + '/' + s.db_name
        database = create_database(path)
        
    elif s.db_engine == 'mysql':
        uri = "mysql://%s:%s@%s:%s/%s"%(s.db_user,
                                        s.db_password, s.db_host,
                                        s.db_port, s.db_name)
        database = create_database(uri)
        
    store = Store(database)
    return store

